]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Add an xevent_filter method to our plugin
authorOwen Taylor <otaylor@src.gnome.org>
Fri, 31 Oct 2008 18:02:52 +0000 (18:02 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 31 Oct 2008 18:02:52 +0000 (18:02 +0000)
By default, mutter doesn't pass events to clutter. We need to add an
xevent_filter method to our plugin and do that ourselves.

svn path=/trunk/; revision=7

src/gnome-shell-plugin.c

index 5ff0a5a924383bb69ebd09f9217d3e964fe4e128..25cd91c45235dcb7b76d02e3d67291a6e574faad 100644 (file)
@@ -29,6 +29,7 @@
 #include <glib/gi18n-lib.h>
 
 #include <clutter/clutter.h>
+#include <clutter/x11/clutter-x11.h>
 #include <gjs/gjs.h>
 #include <gmodule.h>
 #include <string.h>
@@ -38,6 +39,7 @@
 static gboolean do_init (const char *params);
 static gboolean reload  (const char *params);
 
+static gboolean xevent_filter (XEvent *xev);
 
 /*
  * Create the plugin struct; function pointers initialized in
@@ -72,6 +74,9 @@ g_module_check_init (GModule *module)
   /* The reload handler */
   plugin->reload = reload;
 
+  /* Event handling */
+  plugin->xevent_filter = xevent_filter;
+
   return NULL;
 }
 
@@ -159,6 +164,12 @@ reload (const char *params)
   return FALSE;
 }
 
+static gboolean
+xevent_filter (XEvent *xev)
+{
+  return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
+}
+
 /*
  * GModule unload function -- do any cleanup required.
  */